﻿
@{
    ViewBag.Title = Resources.WebStringsWeb.WebTitle;
    Layout = "~/Views/Shared/_LayoutMobile.cshtml";
}
@section css {
    <link href="~/Assets/css/previewImage.css" rel="stylesheet" />
    <link href="~/Assets/css/mui.picker.min.css" rel="stylesheet" />
    <script src="~/Assets/js/mui.picker.js"></script>
    <script src="~/Assets/js/mui.picker.min.js"></script>
    <script src="~/Assets/js/mui.dtpicker.js"></script>
    <style>
        .IsException {
            color: red;
        }

        .IsNormal {
            color: blue;
        }

        .mui-bar ~ .mui-content .mui-scroll-wrapper {
            top: 44px;
            height: auto;
        }

        .hide {
            display: none;
        }
    </style>
}


<div ng-cloak ng-controller="CheckFormController" ng-init="GetSuperviseCheckType();ImageCount=[0,1,2];PlaceList = [];Id='@(Request.QueryString["Id"].IsEmpty() ? "" : Request.QueryString["Id"])';GetCheckFeedbackDetail(Id);">
    <header class="mui-bar mui-bar-nav">
        <button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left" style="color:white;">
            <span class="mui-icon mui-icon-left-nav" style=""></span>
        </button>
        <a ng-touchstart="ScanAddPlace()" class="mui-icon-extra mui-icon-extra-sweep mui-pull-right" style="margin-right: -10px; margin-top: 10px; padding-right: 10px; padding-left: 10px;"></a>
        <h1 class="mui-title" style="color:white;">安全监督检查</h1>
    </header>

    <div class="mui-content" style="margin: 5px;" ng-init="InitDatePicker('#datetime');">
        <form class="mui-input-group">
            <div class="mui-input-row">
                <label>被检查部门</label>
                <input type="text" ng-model="AddModel.CheckedDepartment" placeholder="此处输入被检查部门" />
            </div>
            <div class="mui-input-row">
                <label>地点</label>
                <input type="text" ng-model="AddModel.CheckPlace" placeholder="此处输入地点" />
            </div>
            <div class="mui-input-row">
                <label>检查类型</label>
                <select ng-model="AddModel.CheckType">
                    <option ng-repeat="x in CheckTypeList" value="{{x.Id}}">{{x.IntervalName}}</option>
                </select>
            </div>
            <div class="mui-input-row">
                <label>检查时间</label>
                <input type="text" ng-model="AddModel.CheckTime" data-options='{"type":"date"}' id="datetime" placeholder="检查时间" />
            </div>
        </form>
        <p style="margin: 10px 5px;">监督检查人员</p>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <textarea rows="5" placeholder="监督检查人员" ng-model="AddModel.CheckUser"></textarea>
        </div>
        <p style="margin: 10px 5px;" ng-if="PlaceList.length>0">当前检查场所</p>
        <div class="mui-card" ng-repeat="x in PlaceList">
            <div class="mui-card-header">{{x.PlaceName}} <button class="mui-btn mui-btn-primary mui-btn-outlined" type="button" onclick="hideorshow(this);">收起</button></div>
            <div class="mui-card-content">
                <div class="mui-card-content-inner">
                    <form class="mui-input-group">
                        <div class="mui-input-row">
                            <label>责任部门</label>
                            <input type="text" value="{{x.DepartmentName}}" readonly>
                        </div>
                        <div class="mui-input-row">
                            <label>部门负责人</label>
                            <input type="text" value="{{x.DepartmentManager}}" readonly>
                        </div>

                        <div class="mui-input-row">
                            <label>责任人</label>
                            <input type="text" value="{{x.ResponsibleName}}" readonly>
                        </div>
                        <div class="mui-input-row">
                            <label>检查项目</label>
                        </div>
                        <div>
                            <ul class="mui-table-view">
                                <li style="color:red;text-align:center;" ng-show="x.CheckOptionList==null || x.CheckOptionList.length==0">
                                    <span>暂未分配检查任务</span>
                                </li>
                                <li class="mui-table-view-cell mui-collapse" ng-repeat="y in x.CheckOptionList">
                                    <a class="mui-navigate-right" style="white-space:unset;">
                                        {{$index+1}}.{{y.CheckContent}}<br />
                                        <span ng-show="y.Result==1" style="color:green;font-weight:bold;">正常</span><span ng-show="y.Result==0" style="color: red; font-weight: bold;">异常</span>
                                    </a>
                                    <div class="mui-collapse-content">
                                        <form class="mui-input-group">
                                            <div class="mui-input-row" ng-show="y.IsValue">
                                                <label>&nbsp;&nbsp;测量值<span style="color:red">*</span></label>
                                                <input type="text" ng-model="y.DataValue" placeholder="测量值">
                                            </div>
                                            <div class="mui-input-row mui-radio mui-left">
                                                <label>正常</label>
                                                <input id="r_{{$index}}_t" name="radio_{{$index}}" type="radio" ng-click="y.Result=1" checked>
                                            </div>
                                            <div class="mui-input-row mui-radio mui-left">
                                                <label>异常</label>
                                                <input id="r_{{$index}}_f" name="radio_{{$index}}" ng-click="y.Result=0" type="radio">
                                            </div>
                                            <div class="mui-input-row">
                                                <label>&nbsp;&nbsp;&nbsp;&nbsp;备注</label>
                                                <input type="text" ng-model="y.Remark" placeholder="此处输入备注">
                                            </div>
                                        </form>
                                        <p style="margin-top:30px;">上传照片（总大小在10M以下）</p>
                                        <div class="row image-list" style="margin-top:20px;">
                                            <div class="image-item space" style="display:inline-block;margin-left:10px;" ng-repeat="z in ImageCount" id="imagebox-{{y.OptionId}}_{{z}}"></div>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>
            </div>
            <div class="mui-card-footer">
                <button class="mui-btn mui-btn-primary" type="button" ng-click="AddCheckPlace(x);">保存</button>&nbsp;&nbsp;
                <button class="mui-btn mui-btn-danger" type="button" ng-click="RemoveCheckPlace(x);">删除</button>
            </div>
        </div>

        <p style="margin: 10px 5px;" ng-if="PlaceCheckedList.length>0">已检查场所</p>
        <div class="mui-card" ng-repeat="x in PlaceCheckedList">
            <div class="mui-card-header">{{x.PlaceName}} <button class="mui-btn mui-btn-primary mui-btn-outlined" type="button" onclick="hideorshow(this);">显示</button></div>
            <div class="mui-card-content hide">
                <div class="mui-card-content-inner">
                    <form class="mui-input-group">
                        <div class="mui-input-row">
                            <label>责任部门</label>
                            <input type="text" value="{{x.DepartmentName}}" readonly>
                        </div>
                        <div class="mui-input-row">
                            <label>部门负责人</label>
                            <input type="text" value="{{x.DepartmentManager}}" readonly>
                        </div>
                        <div class="mui-input-row">
                            <label>责任人</label>
                            <input type="text" value="{{x.ResponsibleName}}" readonly>
                        </div>
                        <div class="mui-input-row">
                            <label>检查项目</label>
                        </div>
                        <div>
                            <ul class="mui-table-view">
                                <li class="mui-table-view-cell mui-collapse" ng-repeat="y in x.CheckItemList">
                                    <a class="mui-navigate-right" style="white-space:unset;">
                                        {{$index+1}}.{{y.CheckContent}}<br />
                                        <span ng-show="y.Result==1" style="color:green;font-weight:bold;">正常</span><span ng-show="y.Result==0" style="color: red; font-weight: bold;">异常</span>
                                    </a>
                                    <div class="mui-collapse-content">
                                        <form class="mui-input-group">
                                            <div class="mui-input-row" ng-if="y.IsValue">
                                                <label>&nbsp;&nbsp;测量值<span style="color:red">*</span></label>
                                                <input type="text" ng-model="y.DataValue" placeholder="测量值">
                                            </div>
                                            <div class="mui-input-row" ng-if="y.Remark!=null">
                                                <label>&nbsp;&nbsp;&nbsp;&nbsp;备注</label>
                                                <input type="text" ng-model="y.Remark" placeholder="">
                                            </div>
                                        </form>
                                        <p style="margin-top:30px;" ng-if="y.FileList.length>0">照片</p>
                                        <div class="row image-list" style="margin-top:20px;">
                                            <img ng-repeat="z in y.FileList" class="image-item space" ng-src="{{z.FilePath}}" data-preview-src="" data-preview-group="{{$parent.$index+1}}" style="display: inline-block; margin-left: 10px;" width="50" />
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>
            </div>
            <div class="mui-card-footer">
                <button class="mui-btn mui-btn-danger mui-pull-right" type="button" ng-click="DeletePlaceCheck(x);">删除</button>
            </div>
        </div>
        <p style="margin: 10px 5px;">安全生产监督检查主要内容</p>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <textarea rows="5" placeholder="安全生产监督检查主要内容" ng-model="AddModel.CheckContent"></textarea>
        </div>
        <p style="margin: 10px 5px;">存在问题及处理意见(建议)</p>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <textarea rows="5" placeholder="存在问题及处理意见(建议)" ng-model="AddModel.Advice"></textarea>
        </div>
        <p style="margin: 10px 5px;">被检查单位确认人</p>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <textarea rows="5" placeholder="被检查单位确认人" ng-model="AddModel.CheckedPerson"></textarea>
        </div>
        <p style="margin: 10px 5px;">被检查单位对问题处置情况</p>
        <div class="mui-input-row" style="margin: 10px 5px;">
            <textarea rows="5" placeholder="被检查单位对问题处置情况" ng-model="AddModel.DisposalProcess"></textarea>
        </div>
        <div class="mui-button-row" style="margin-bottom:80px;">
            <button type="button" ng-click="EditCheckFeedback(AddModel);" ng-disabled="Loading" class="mui-btn mui-btn-primary mui-btn-block">提&nbsp;&nbsp;&nbsp;交</button>
        </div>
    </div>

</div>

@section js{
    <script src="~/Assets/js/mui.zoom.js"></script>
    <script src="~/Assets/js/mui.previewimage.js"></script>
    <script src="~/Assets/js/libs/upload.js"></script>
    <script src="~/Assets/js/pg/MCheckForm.js?v=@DateTime.Now.ToString("yyyyMMddHHmm")"></script>

    <script>
        mui.init({
            swipeBack: false,
            keyEventBind: {
                backbutton: false  //关闭back按键监听
            }
        });
        mui.showLoading("正在加载..", "div");
        setTimeout(function () {
            mui.hideLoading();
        }, 2000);

        function hideorshow(control) {
            var content = $(control).parent().next();
            if (content.hasClass('hide')) {
                $(control).html('收起');
                content.removeClass('hide');

            }
            else {
                $(control).html('展开');
                content.addClass('hide');
            }
        }

    </script>
}

